package com.nuoniu.sibanyun.controller.erp;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.erp.ErpBarcodeTemplate;
import com.nuoniu.sibanyun.service.erp.IErpBarcodeTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 条码模版 前端控制器
 * </p>
 *
 * @author 小啊刚
 * @since 2021-11-13
 */
@RestController
@RequestMapping("/barcode/template")
@Api(tags = "条码模版管理")
public class ErpBarcodeTemplateController extends BaseController {

    @Autowired
    private IErpBarcodeTemplateService barcodeTemplateService;

    @ApiOperation("获取列表")
    @GetMapping("getList")
    public HttpResult<ErpBarcodeTemplate> pageList(ErpBarcodeTemplate template) {
        return HttpResult.ok(barcodeTemplateService.getList(template));
    }

    @ApiOperation("保存")
    @PostMapping("save")
    public HttpResult save(@RequestBody ErpBarcodeTemplate barcodeTemplate) {
        barcodeTemplateService.saveTemplate(barcodeTemplate);
        return HttpResult.ok();
    }

    @ApiOperation("获取详情")
    @GetMapping("getDetail")
    public HttpResult<ErpBarcodeTemplate> pageList(Long id) {
        return HttpResult.ok(barcodeTemplateService.getById(id));
    }

    @ApiOperation("删除")
    @DeleteMapping("delete")
    public HttpResult delete(Long id) {
        barcodeTemplateService.removeById(id);
        return HttpResult.ok();
    }
}
